package com.moxiao.yfjh.module.blind.dal.mysql.recommendRecord;

import com.moxiao.yfjh.module.blind.controller.admin.recommendRecord.vo.RecommendRecordExportReqVO;
import com.moxiao.yfjh.module.blind.controller.admin.recommendRecord.vo.RecommendRecordPageReqVO;
import java.util.*;

import com.moxiao.yfjh.framework.common.pojo.PageResult;
import com.moxiao.yfjh.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.moxiao.yfjh.framework.mybatis.core.mapper.BaseMapperX;
import com.moxiao.yfjh.module.blind.dal.dataobject.recommendRecord.RecommendRecordDO;
import org.apache.ibatis.annotations.Mapper;
import com.moxiao.yfjh.module.blind.controller.admin.recommendRecord.vo.*;

/**
 * 相亲超级推荐记录 Mapper
 *
 * @author mx
 */
@Mapper
public interface RecommendRecordMapper extends BaseMapperX<RecommendRecordDO> {

    default PageResult<RecommendRecordDO> selectPage(RecommendRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RecommendRecordDO>()
                .eqIfPresent(RecommendRecordDO::getUserId, reqVO.getUserId())
                .eqIfPresent(RecommendRecordDO::getNum, reqVO.getNum())
                .likeIfPresent(RecommendRecordDO::getEquityName, reqVO.getEquityName())
                .eqIfPresent(RecommendRecordDO::getSceneId, reqVO.getSceneId())
                .eqIfPresent(RecommendRecordDO::getUsedBy, reqVO.getUsedBy())
                .betweenIfPresent(RecommendRecordDO::getBeginTime, reqVO.getBeginTime())
                .betweenIfPresent(RecommendRecordDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(RecommendRecordDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(RecommendRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RecommendRecordDO::getId));
    }

    default List<RecommendRecordDO> selectList(RecommendRecordExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<RecommendRecordDO>()
                .eqIfPresent(RecommendRecordDO::getUserId, reqVO.getUserId())
                .eqIfPresent(RecommendRecordDO::getNum, reqVO.getNum())
                .likeIfPresent(RecommendRecordDO::getEquityName, reqVO.getEquityName())
                .eqIfPresent(RecommendRecordDO::getSceneId, reqVO.getSceneId())
                .eqIfPresent(RecommendRecordDO::getUsedBy, reqVO.getUsedBy())
                .betweenIfPresent(RecommendRecordDO::getBeginTime, reqVO.getBeginTime())
                .betweenIfPresent(RecommendRecordDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(RecommendRecordDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(RecommendRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RecommendRecordDO::getId));
    }

}
